const { User } = require('../../model/user');
module.exports = async (req, res) => {
    // 标识 标识当前访问的是用户管理页面
    req.app.locals.currentLink = 'user';
    let page = req.query.page || 1;
    let pageSize = 5;
    let userSize = await User.countDocuments({});
    let userPage = Math.ceil(userSize / pageSize);
    let start = (page - 1) * pageSize;
    let users = await User.find({}).limit(pageSize).skip(start);
    res.render('admin/user', {
        users: users,
        page: page,
        total: userPage
    });
}